/*
 * Copyright (C) 2010 http://laantiguafragua.blogspot.com/
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * FileData.java
 *
 * Created on 02/24/2010
 */

package simplefileupdate;

import java.net.URL;
import java.util.ArrayList;
import java.util.Date;

/**
 * This class contains the information of a file
 * @author lhrod
 */
public class FileData {
    /**
     * Internal id, this must be equal in source and the destiny
     */
    public int id;
    /**
     * Name of file
     */
    public String name;
    /**
     * Last date that this file was modified
     */
    public Date date;
    /**
     * Link to download the new version
     */
    public URL url;
    /**
     * Last version of file
     */
    public String version;
    private ArrayList news = new ArrayList();
     /**
     * Size of file
     */
    public long size;
     /**
     * If the file is used it is necessary to restart the application
     */
    public boolean reloadApp;

    FileData(int id, String name, Date date, URL url, String version, long size, boolean reloadApp) {
        this.id = id;
        this.name = name;
        this.date = date;
        this.url = url;
        this.version = version;
        this.size = size;
        this.reloadApp = reloadApp;
    }

    /**
     * Add one news in the file
     * @param tNews
     */
    public void addNews(String tNews)
    {
        news.add(tNews);
    }

    /**
     * Get a list of news in the file
     * @return A array with all news in the file
     */
    public String[] getNews()
    {
        return (news.size() > 0) ? (String [])news.toArray(new String[]{}) : new String[]{};
    }
}